package com.es.service;


import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.GetIndexResponse;

import java.io.IOException;

/**
 * @Author 咕唧
 * @Date 2022/6/21 17:03
 * @Version 1.0
 */
public interface IndexService {
    /**
     * 创建库
     * @param index
     * @param createIndexRequest
     * @return
     * @throws IOException
     */
    CreateIndexResponse createIndex(String index, CreateIndexRequest createIndexRequest) throws IOException;

    /**
     * 判断库是否存在
     * @param index
     * @return
     * @throws IOException
     */
    boolean indexExist(String index) throws IOException;

    /**
     * 删除库
     * @param index
     * @throws Exception
     */
    AcknowledgedResponse deleteIndex(String index) throws Exception;

    /**
     * 查看库
     * @param index
     * @throws Exception
     */
    GetIndexResponse getIndex(String index) throws Exception;
}
